/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MODEL;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Observable;

/**
 *
 * @author Irene & Morten
 */
public class Journal extends Observable implements Serializable {

    private String note;
    private float goal;
    private float currWeight;
    private float result;
    private String title;
    private ArrayList<String> positive;
    private ArrayList<String> negative;

   

    /*Constructor journal which takes a title and adds it to a positive or negative list
     * @param title is the title to add
     */
    public Journal(String title) {
        this.title = title;
        positive = new ArrayList<String>();
        negative = new ArrayList<String>();
    }

    public ArrayList<String> getNegative() {
        return negative;
    }

    public ArrayList<String> getPositive() {
        return positive;
    }

    public String getTitle() {
        return title;
    }

    public void addNoteToPositive(String note) {
        this.note = note;
        positive.add(note);
        setChanged();
        notifyObservers();
    }

    public void addNoteToNegative(String note) {
        this.note = note;
        negative.add(note);
        setChanged();
        notifyObservers();
    }

    public void removePos(String s) {
        positive.remove(s);
        setChanged();
        notifyObservers();

    }

    public void removeNeg(String s) {
        negative.remove(s);
        setChanged();
        notifyObservers();
    }

    /** returns the goal weight of the journal
     * @return the goal
     */
    public float getGoal() {
        return goal;
    }

    /** is the goal to enter
     * @param goal the goal to set
     */
    public void setGoal(float goal) {
        this.goal = goal;
        setChanged();
        notifyObservers();
    }

    /** is the current weight to enter
     * @return the currWeight
     */
    public float getCurrWeight() {
        return currWeight;
    }

    /**sets the current weight
     * @param currWeight the currWeight to set
     */
    public void setCurrWeight(float currWeight) {
        this.currWeight = currWeight;
        setChanged();
        notifyObservers();
    }

    /** gets the result of the weight
     * @return the result
     */
    public float getResult() {
        return result;
    }

    /** sets the result
     * @param result the result to set
     */
    public void setResult(float result) {
        this.result = result;
        setChanged();
        notifyObservers();
    }
/*Overrides the object and returns is as a line of text.
 *
 */
    @Override
    public String toString()
    {
        return this.title;
    }

 
}



